package beautiful.butterfly;

import beautiful.butterfly.server.httpserver.mvc.aop.AllowNotLogin;
import beautiful.butterfly.server.httpserver.mvc.core.Controller;
import beautiful.butterfly.server.httpserver.mvc.core.annotation.actionbind.ActionKey;
import beautiful.butterfly.server.httpserver.mvc.render.Render;
import beautiful.butterfly.server.httpserver.mvc.render.TextRender;
import beautiful.butterfly.server.httpserver.mvc.render.VelocityRender;

import java.util.ArrayList;
import java.util.List;

@ActionKey("/index")
public class Test extends Controller {
    @AllowNotLogin
    public Render hello() {
        return new TextRender("hello");
    }

    @AllowNotLogin
    public Render world() {
        setAttribute("hello", "你好");
        setAttribute("world", "世界");
        List<String> list = new ArrayList<String>();
        list.add("测试1");
        list.add("测试2");
        setAttribute("list", list);
        return new VelocityRender("/hellovelocity.vm");
    }

}